#!/bin/bash

if [ $# -lt 1 ]; then
    exit 1
fi

if [ ! -d $1 ]; then
    mkdir -p $1
fi
# 获取系统盘的标识
OS_Disk_Symbol=$(df -h | awk '$6~/boot/{print $1}' | sed 's/[0-9]//g' | sed 's/^\/.*\///g')
# 剔除系统盘获取可用数据盘进行挂载
Dest_Format_Disk=$(lsblk | awk '$6=="disk"{print $1}' | grep -v $OS_Disk_Symbol | grep -v fd0 | head -1)
if [ ! -z $Dest_Format_Disk ]; then
    umount /dev/$Dest_Format_Disk
    mkfs.ext4 -F /dev/$Dest_Format_Disk
    mount /dev/$Dest_Format_Disk $1
    exit
else
    exit 1
fi
